# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Fabio Ribeiro <fabiorphp@gmail.com>
pkgname=php7-pecl-mailparse
_extname=mailparse
pkgver=3.1.3
pkgrel=0
pkgdesc="PHP 7 extension for parsing and working with email messages - PECL"
url="https://pecl.php.net/package/mailparse"
arch="all"
license="PHP-3.01"
depends="php7-mbstring"
makedepends="php7-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"
provides="php7-mailparse=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-mailparse" # for backward compatibility

build() {
	phpize7
	./configure --prefix=/usr --with-php-config=php-config7
	make
}

check() {
	# Tests require mbstring extension which is not bundled
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=/usr/lib/php7/modules/mbstring.so \
		-d extension=modules/$_extname.so" TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php7/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/60_$_extname.ini
}

sha512sums="
93659e479d8ab61ae473f6dc002b7198903eebdcfb4aa515e76952f5050fd1a815baccfcb57bd32fb9be6108dfed6dc73172067a58c9e6098058999bb3802000  php-pecl-mailparse-3.1.3.tgz
"
